<h1>Excursion View</h1>
<div id="infomessage" style="display: none;"></div>
<div>
    <table class="tablesorter" id="carviews" cellpadding="0" cellspacing="0" width="100%">
        <thead>
            <tr>
                <!--<th width="30" style="text-align: center;">ID</th>-->
                <th width="85" style="text-align: center;">Photo</th>
                <th>Excursion name</th>
                <th>Info</th>
                <th>Status</th>
                <th width="220" style="text-align: center;">Action</th>
            </tr>
        </thead>
        <tbody>
            <? foreach($excursions as $excursion): ?>
                <tr>
                    <!--<td style="text-align: center;"><?=$excursion['id']?></td>-->
                    <td style="text-align: center; vertical-align: middle;">
                        <?
                            $image = $this->db->get_where('excimg',array('excursions_id' => $excursion['id']))->result_array();
                            if(isset($image[0]['url'])){
                                ?>
                                    <img src="<?=base_url()?>assets/img/excursions/<?=$image[0]['url']?>.jpg" alt="excursion_<?=$excursion['id']?>" style="padding: 1px; border: 1px solid #f1f1f1; width: 82px;" />
                                <?
                            }else echo "No image";
                        ?>
                        
                    </td>
                    <td  class="exc_title"><strong><?=$excursion['title']?></strong></td>                    
                    <td style="line-height: 16px;" class="exc_info">
                        Price fo Adult: <?=$excursion['adultPrice']?>&euro;<br />
                        Price for Children: <?=$excursion['childPrice']?>&euro;<br />
                        Capacity: <?=$excursion['capacity']?> persons
                    </td>
                    <td style="vertical-align: middle; text-align: center;">
                        <?
                            switch ($excursion['status']){
                                case 0:
                                ?>
                                <img src="<?=base_url()?>assets/img/backgrounds/item-closed.png" alt="Excursion closed"  />
                                <?
                                    break;
                                case 1:
                                ?>
                                <img src="<?=base_url()?>assets/img/backgrounds/item-open.png" alt="Excursion open"  /> 
                                <?
                                    break;
                            }
                        ?>
                    </td> 
                    <td style="text-align: center; padding-top: 4px;" class="actiontd">
                        <a href="<?=site_url().'excursions/excursions/edit/'.$excursion['id'];?>" class="edit_grid" id="<?=$excursion['id']?>">Uredi</a> 
                        <a href="javascript:void(null);" class="delete_grid" id="ex_<?=$excursion['id']?>">Briši</a>
                        <a href="<?=base_url()?>image/addnew_form/<?=$excursion['id'];?>" class="add_foto">Slike</a> 
                        <?
                            switch ($excursion['status']){
                                case 0:
                                ?>
                                <a href="<?=base_url()?>excursions/excursions/set_status/<?=$excursion['id'];?>/1" class="set_status">Aktiviraj</a>    
                                <?
                                    break;
                                case 1:
                                ?>
                                <a href="<?=base_url()?>excursions/excursions/set_status/<?=$excursion['id'];?>/0" class="set_status">Dektiviraj</a>    
                                <?
                                    break;
                            }
                        ?>

                    </td>
                </tr>
                <? endforeach;  ?>
        </tbody>
    </table>
</div>